package com.zhanhong.opencvdemo.utils;

import android.os.Handler;
import android.os.Looper;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;



public class ThreadUtils {

    private ThreadUtils() {

    }

    private static Handler sHandler = new Handler(Looper.getMainLooper());//获取主线程的Looper
    private static Executor sExecutors = Executors.newCachedThreadPool(); //创建线程池

    public static void runOnSubThread(Runnable runnable) {
        sExecutors.execute(runnable);
    }

    public static void runOnUIThread(Runnable runnable) {
        sHandler.post(runnable);
    }


}
